package com.mk.es.demo.es;

import lombok.Builder;
import lombok.Data;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

import java.util.Date;

@Data
@Builder
@Document(indexName = "user")
public class User {

    @Id
    private Long id;

    @Field(type = FieldType.Date, store = true)
    private Date birthday;

    @Field(type = FieldType.Float)
    private Float money;

    @Field(type = FieldType.Byte, store = true)
    private byte sex;

    @Field(type = FieldType.Integer)
    private Integer age;

    @Field(type = FieldType.Float, analyzer = "ik_max_word")
    private String desc;

    @Field(type = FieldType.Keyword)
    private String username;
}
